﻿using System;

namespace Zavand.Web.Mvc.Manana.SampleWebsite.Common
{
    public class User
    {
        public int ID { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public DateTime? Birthday { get; set; }
    }
    public static class UserConvertor
    {
        public static User Clone(User o)
        {
            var u = new User();
            Update(u,o);
            return u;
        }

        /// <summary>
        /// Updates one object with another
        /// </summary>
        /// <param name="u">This object will be updated</param>
        /// <param name="o">Another object will be updated from this object</param>
        public static void Update(User u, User o)
        {
            u.FirstName = o.FirstName;
            u.LastName = o.LastName;
            u.Birthday = o.Birthday;
            u.ID = o.ID;
        }
    }
}